using Microsoft.Xna.Framework;
using BicycleTrafficSimulator.DataModel;


namespace BicycleTrafficSimulator.CarBehaviour
{
    class LinearBehaviour 
    {
        Car car;

        public LinearBehaviour(Car car)
        {
            this.car = car;
            car.MoveSpeed = car.MaxMoveSpeed;
        }

        /// This Update finds the direction vector that goes from a straight 
        /// line directly to the current waypoint
        public void Update(GameTime gameTime)
        {
            Vector3 direction = -(car.Position - car.Waypoints.Peek());
            direction.Normalize();
            car.Direction = direction;
        }

    }
}
